package net.oschina.simpleplus.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import net.oschina.simpleplus.entity.Note;

public interface NoteDao {

	@Select("select * from note where userId = #{userId}")
	List<Note> selectNotes(Integer userId);
	
	@Insert("insert into note (userId, title, content, noteBookName, tags, lastUpdateTime) values (#{userId}, #{title}, #{content}, #{noteBookName}, #{tags}, #{lastUpdateTime})")
	@Options(keyColumn="id", keyProperty="id", useGeneratedKeys=true)
	public int saveNewNote(Note note);
	
	
	@Update("Update note set title = #{title}, content = #{content}, noteBookName = #{noteBookName}, tags =#{tags}, lastUpdateTime=#{lastUpdateTime} where id= #{id}")
	public int updateNote(Note note);
}
